package lambda;

public class lam1 {
    public static void main(String[] args) {
    eatop e = new eatop();
    eatopp(e);

    eatopp(new eatable() {
        @Override
        public void eat() {
            System.out.println("匿名内部类" );
        }
    });

   eatopp( ()->{
       System.out.println("lambda" );
   });
//省略模式
        eatopp( ()->
            System.out.println("lambda" )
        );

    flyy(
            (f)->{
        System.out.println("12FLY");
    }
    );
//省略模式
 flyy(
         f->
            System.out.println("12FLY")
        );

    adds(
            (int a,int b)->{
        System.out.println(a+b);
    }
    );
//省略模式
        adds(
                ( a, b)->
            System.out.println(a+b)
        );

        addss(
                (int a,int b)->{
                    return a+b ;
                }
        );
//省略模式
        addss(
                (a,b)-> a+b

        );



    }
    public static void eatopp(eatable e){
        e.eat();
    }

    public  static void flyy(flyable f){
        f.fly("fly");
    }

    public static void adds(addable a){
        a.add(10,15);
    }

    public static void addss(add a){
        a.add(10,15);
    }
}

